<?php
include_once 'include/control/context.php.inc';
include_once('saet.ex.class.php');
include_once('config/config.php');
include_once('include/model/Reply.php');
include_once('include/dao/ReplyDAO.php');

if($current_usr){
	$r = new Reply();
	$r-> User -> id =  $current_usr-> id;
	$r-> post_id = $_POST['post_id'];	
	$r-> content =  $_POST['content'];
	
	$dao = new  ReplyDAO();
	$dao-> insert($r);
	
	if($_POST['needSyn']){	
		$tStauts = mb_substr(str_replace('\r\n','',$r-> content),0,120,'utf-8') .'http://itjobs.sinaapp.com/job/'.$r-> post_id;
		$tclient = new SaeTClient(WB_AKEY,WB_SKEY,
		$current_usr->access_token,
		$current_usr->access_token_secret);
		$tclient->update($tStauts);
	}
	
	header("Location: /job/$r->post_id");
}
?>